package com.ic.loan.activity

import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import com.blankj.utilcode.util.ActivityUtils
import com.blankj.utilcode.util.SPUtils
import com.blankj.utilcode.util.SpanUtils
import com.gyf.immersionbar.ktx.immersionBar
import com.ic.loan.R
import com.ic.loan.cache.Constant
import com.ic.loan.pop.PrivacyPolicyPop
import com.lxj.xpopup.XPopup
import kotlinx.android.synthetic.main.activity_user_agreement.*

class UserAgreementActivity : BaseActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        immersionBar {
            statusBarDarkFont(true)
            statusBarView(sp_status_bar)
        }
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_user_agreement)
        SpanUtils.with(tvTerms)
            .append("TERMS OF CONDITIONS,")
            .setFontSize(36)
            .setClickSpan(Color.parseColor("#AF2930"),true) {
                ActivityUtils.startActivity(TermsOfConditionsActivity::class.java)
            }
            .append(" PRIVACY POLICY.")
            .setClickSpan(Color.parseColor("#AF2930"),true) {
                XPopup.Builder(this).asCustom(PrivacyPolicyPop(this)).show()
            }
            .setFontSize(36)
            .create()
        tvAccept.setOnClickListener {
            ActivityUtils.startActivity(LoginActivity::class.java)
            SPUtils.getInstance().put(Constant.AGREEMENT,true)
            onBackPressed()
        }
        tvDecline.setOnClickListener {
            onBackPressed()
        }
    }
}